"use strict";
cc._RF.push(module, '7958frmyBlIgKmZ0ELxtZ0P', 'SwitchScene');
// Script/SwitchScene.js

"use strict";

// Learn cc.Class:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
var AU = require("AudioUtils");
cc.Class({
    extends: cc.Component,

    properties: {},

    /**
     * 开始场景切换到主游戏场景
     */
    toMainScene: function toMainScene() {
        AU.inst.playEffect(EFFECT_SELECT1, false);
        this.node.runAction(cc.fadeOut(1.0));
        cc.director.loadScene("MainScene");
    },

    /**
     * 显示排行榜
     */
    showRankPage: function showRankPage() {
        wx.getOpenDataContext().postMessage({
            command: "getRank" //指令
        });
        var bgRank = cc.find('Canvas/bg_rank');
        bgRank.active = true;
    },

    closeRankPage: function closeRankPage() {
        var bgRank = cc.find('Canvas/bg_rank');
        bgRank.active = false;
    },

    /**
     * 显示系统设置
     */
    showSetPage: function showSetPage() {
        AU.inst.playEffect(EFFECT_SELECT1, false);
        var bgSetup = cc.find('Canvas/bg_setup');
        bgSetup.active = true;
    },

    closeSetPage: function closeSetPage() {
        var bgSetup = cc.find('Canvas/bg_setup');
        bgSetup.active = false;
    },

    onLoad: function onLoad() {
        cc.director.preloadScene('MainScene', function () {
            //预加载MainScene场景
            cc.log('Next scene preloaded');
        });
    },
    start: function start() {}
});

cc._RF.pop();